﻿import java.util.Scanner;

public class HomeWork {

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		String[] musics ={"Island","Ocean","Pretty","Sun"};
		String[] newMusics = new String[musics.length+1];
		String music = "";
		System.out.print("输入插入前的数组为：");
		for (int i = 0; i < musics.length; i++) {
			System.out.print(musics[i]+" ");
		}
		for (int i = 0; i < musics.length; i++) {
			newMusics[i] = musics[i];
		}
		
		System.out.print("\n请输入需要插入的音乐：");
		music = input.next();
		int index = musics.length;
		for (int i = 0; i < newMusics.length-1; i++) {
			if(musics[i].compareToIgnoreCase(music)>0){
				index = i;
				break;
			}
		}
		for (int i =newMusics.length-1; i > index; i--) {
			newMusics[i]  = newMusics[i-1];
		}
		newMusics[index] = music;
		System.out.println("插入后的数组是：");
		for (int i = 0; i < newMusics.length; i++) {
			System.out.print(newMusics[i]+" ");
		}
	}
}